/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
}

/* Main container - adapts to iframe or standalone */
#app-container {
    width: 100%;
    height: 450px;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* Standalone mode - full viewport */
@media (min-height: 500px) {
    #app-container {
        height: 90vh;
    }
}

/* Tooltip styling */
.tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    color: #fff;
    padding: 15px 20px;
    border-radius: 12px;
    font-size: 14px;
    max-width: 80%;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 2px solid #ffd700;
}

.tooltip.show {
    opacity: 1;
}

/* Story panel */
.story-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    height: 100%;
    text-align: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.detective-avatar {
    font-size: 80px;
    margin-bottom: 15px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.dialogue-text {
    color: #fff;
    font-size: 16px;
    line-height: 1.6;
    max-width: 600px;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

/* Action buttons */
.action-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #1a1a2e;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    white-space: nowrap;
    min-height: 44px;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Game area */
.game-area {
    padding: 15px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hidden {
    display: none !important;
}

/* Top bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.score-display, .streak-display {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #fff;
    font-weight: bold;
    font-size: 14px;
}

#score, #streak {
    color: #ffd700;
    font-size: 18px;
}

.label {
    font-size: 12px;
    opacity: 0.9;
}

/* Case file */
.case-file {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px;
    border: 2px solid rgba(255, 215, 0, 0.4);
    backdrop-filter: blur(10px);
}

.case-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.case-number {
    color: #ffd700;
    font-weight: bold;
    font-size: 12px;
    letter-spacing: 1px;
}

.hint-btn {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 215, 0, 0.4);
}

.hint-btn:hover {
    background: rgba(255, 215, 0, 0.3);
    transform: scale(1.05);
}

.clue-text {
    color: #fff;
    font-size: 15px;
    line-height: 1.5;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border-left: 4px solid #ffd700;
    font-style: italic;
}

/* Category container */
.category-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    flex: 1;
    min-height: 0;
}

.category-bin {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.category-bin:hover {
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.2);
}

.bin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 5px;
}

.bin-icon {
    font-size: 20px;
}

.bin-title {
    color: #fff;
    font-weight: bold;
    font-size: 13px;
    flex: 1;
    text-align: center;
}

.info-icon {
    font-size: 14px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.info-icon:hover {
    opacity: 1;
}

/* Drop zone */
.drop-zone {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    text-align: center;
    padding: 8px;
    transition: all 0.3s ease;
    min-height: 80px;
    cursor: pointer;
}

.drop-zone:hover {
    border-color: rgba(255, 215, 0, 0.6);
    background: rgba(255, 215, 0, 0.1);
}

.drop-zone.drag-over {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.2);
    transform: scale(1.02);
}

.drop-zone.selected {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.4), rgba(118, 75, 162, 0.4));
    border: 2px solid #ffd700;
    color: #fff;
    font-weight: bold;
}

.collected-count {
    color: #ffd700;
    font-size: 11px;
    text-align: center;
    margin-top: 6px;
    font-weight: bold;
}

.count {
    font-size: 13px;
}

/* Action container */
.action-container {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.submit-btn, .next-btn {
    flex: 1;
    max-width: 200px;
}

.next-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

/* Feedback overlay */
.feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.feedback-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 80%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 3px solid #ffd700;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.8); }
    to { transform: scale(1); }
}

.feedback-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

.feedback-text {
    color: #fff;
    font-size: 16px;
    line-height: 1.6;
    font-weight: bold;
}

/* Completion panel */
.completion-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
}

.completion-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 3px solid #ffd700;
    max-width: 500px;
}

.completion-icon {
    font-size: 80px;
    margin-bottom: 15px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.completion-content h2 {
    color: #ffd700;
    font-size: 28px;
    margin-bottom: 15px;
}

.final-message {
    color: #fff;
    font-size: 16px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.final-score {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    color: #fff;
    font-size: 18px;
}

.final-score div {
    margin: 8px 0;
}

.final-score span {
    color: #ffd700;
    font-weight: bold;
    font-size: 22px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .category-container {
        grid-template-columns: 1fr;
    }
    
    .bin-title {
        font-size: 14px;
    }
    
    .drop-zone {
        min-height: 60px;
    }
}

/* Touch-friendly sizing */
@media (hover: none) and (pointer: coarse) {
    .drop-zone, .action-btn, .hint-btn, .info-icon {
        min-height: 44px;
        min-width: 44px;
    }
}